519595285 by Unknown

519595285 by Unknown

Author:Unknown
Language: eng
Format: epub


5.7 Verification of text on a page using the Assert class

In the code listing of section we have invoked the verifyUser(String) method from the Homepage Page Object. This Page Object had made use of the assertEquals method from the Assert class. This method is provided the following arguments: an actual string and an expected string. The actual string is the text extracted from the WebElement named userDisplay and this string is extracted using the following code snippet:

SingletonDriver.getInstance().getDrvr().findElement(userDisplay).getText()

The Expected string value is taken from the Feature file. The line from the Feature file shown as follows provides this value.

Then, the User should be shown on top-left hand corner of the page.

If we change the string in the preceding line to “Pinakin Chaubal1”, the test now fails with an Assertion error shown as follows:



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.